home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / proc / fdealloc.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  1KB  |  69 lines

  1. /*
  2.  * CopyRight 1995. Nicholas Poljakov all rights reserved.
  3.  */
  4. #include <malloc.h>
  5. #include <stdio.h>
  6. #include <dos.h>
  7. #include <dall.h>
  8. #include <state1.h>
  9.  
  10. deallocate (tp_id,conv_id,type,
  11.             p_rc)
  12.  
  13. unsigned char *tp_id;
  14. unsigned long conv_id;
  15. unsigned char type;
  16. struct rc {
  17.             unsigned int prim;
  18.             unsigned long sec;
  19.           } *p_rc;
  20.  
  21.  
  22. {
  23.        union REGS inregs,outregs;
  24.        struct SREGS segregs;
  25.        struct deallocate *ptr;
  26.        char _near *dp1;
  27.        char _near *dp2;
  28.        int l;
  29.  
  30.      l = sizeof(struct deallocate);
  31.      if ((ptr = (char *)calloc(1,l)) == NULL) {
  32.         p_rc->prim = PORT_BUSY; /* ¡ÑΓ ñ«ßΓπ»¡«⌐ »á¼∩Γ¿ */
  33.         p_rc->sec = 0x00;
  34.         return(0);
  35.      }
  36.  
  37.      ptr->code=Deallocate;
  38.      ptr->e_cd=0x0000;
  39.  
  40.      memcpy(ptr->tp_id,tp_id,8);
  41.  
  42.      ptr->conv_id = conv_id;
  43.      ptr->type = type;
  44. /*
  45.      inregs.x.dx = FP_OFF(ptr);
  46.      segregs.ds = FP_SEG(ptr);
  47.      inregs.x.ax = ptr->code;
  48.  
  49.      int86x(0x68,&inregs,&outregs,&segregs);
  50.  */
  51.      dp1 = FP_OFF( ptr );
  52.      dp2 = FP_SEG( ptr );
  53.      _asm
  54.          {
  55.             push  ds
  56.             mov   dx, word ptr dp1[0]
  57.             mov   ax, word ptr dp2[0]
  58.             mov   ds, ax
  59.             mov   ax, Deallocate
  60.             int   68h
  61.             pop   ds
  62.          }
  63.  
  64.      p_rc -> prim = ptr -> prim_rc;
  65.      p_rc -> sec =  ptr -> sec_rc;
  66.      free(ptr);
  67.      return(0);
  68. }
  69.